
package com.wyzz.hr.action;

import java.util.List;

import com.wyzz.hr.bo.IEmployeeBo;
import com.wyzz.hr.bo.IPositionBo;
import com.wyzz.hr.pojo.Employee;
import com.wyzz.hr.pojo.Emptransfer;
import com.wyzz.hr.pojo.Position;


public class BatchTransfer extends ProfileAction {

	public BatchTransfer() {
	}

	public String execute() throws Exception {
		IEmployeeBo empBo = (IEmployeeBo) getBean("empBo");
		IPositionBo positionBo = (IPositionBo) getBean("positionBo");
		String empIds[] = ids.split(",");
		Position postion = positionBo.getPosById(newPosition.getId(),
				new String[] { Position.PROP_POSITION_PB_ID,
						Position.PROP_POSITION_PARENT_ID });
		List errors = empBo.batchTransfer(transfer, empIds, getCurrentEmpNo(),
				postion);
		if (!errors.isEmpty())
			addErrorInfo(errors);
		else
			addSuccessInfo(msgTransferBatchSuccess);
		return "success";
	}

	public Emptransfer getTransfer() {
		return transfer;
	}

	public void setTransfer(Emptransfer transfer) {
		this.transfer = transfer;
	}

	public String getIds() {
		return ids;
	}

	public void setIds(String ids) {
		this.ids = ids;
	}

	public Employee getEmp() {
		return emp;
	}

	public void setEmp(Employee emp) {
		this.emp = emp;
	}

	public Position getNewPosition() {
		return newPosition;
	}

	public void setNewPosition(Position newPosition) {
		this.newPosition = newPosition;
	}

	private Emptransfer transfer;
	private Position newPosition;
	private String ids;
	private Employee emp;
}
